#!/usr/bin/python2.4
#
# Copyright 2009-2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========================================================================


Import('env')

run_as_invoker = env.RES('run_as_invoker.res', '$MAIN_DIR/base/run_as_invoker.rc')
env.Depends(run_as_invoker, '$MAIN_DIR/base/run_as_invoker.manifest')

def Buildrunupdate3web(local_env):
  local_env.Append(
      CPPDEFINES = [
          'UNICODE',
          '_UNICODE'
          ],
      LIBS = [
          local_env['atls_libs'][local_env.Bit('debug')],
          local_env['crt_libs'][local_env.Bit('debug')],
          'comctl32.lib',
          'crypt32.lib',
          'Iphlpapi.lib',
          'mstask.lib',
          'netapi32.lib',
          'psapi.lib',
          'shlwapi.lib',
          'urlmon.lib',
          'userenv.lib',
          'version.lib',
          'wininet.lib',
          'wtsapi32.lib',

          local_env.GetMultiarchLibName('base'),
          local_env.GetMultiarchLibName('common'),
          local_env.GetMultiarchLibName('logging'),
          local_env.GetMultiarchLibName('net'),
          local_env.GetMultiarchLibName('statsreport'),
          ],
  )

  local_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
  local_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']

  target_name = 'runupdate3web%s' % ('', '64')[local_env.Bit('x64')]
  inputs = [
      'runupdate3web.cc',
      run_as_invoker,
      ]
  if local_env.Bit('x64'):
    inputs.append('$OBJ_ROOT/goopdate/omaha3_idl_64_i.obj64')
  else:
    inputs.append('$OBJ_ROOT/goopdate/omaha3_idl_i.obj')

  local_env.ComponentTestProgram(
      prog_name=target_name,
      source=inputs,
      COMPONENT_TEST_RUNNABLE=False
  )

Buildrunupdate3web(env.Clone())
Buildrunupdate3web(env.CloneAndMake64Bit())
